﻿/* 点卷商城 - 武器 */

var status = -1;
var itemList = Array(
// -----价格为 10000 点卷 --------
Array(1702565, 20000), //死亡之刃
Array(1702444, 10000), //费尔玛塔
Array(1702451, 10000), //超级巨星麦克风
Array(1702512, 10000), //主人公权杖
Array(1702556, 10000), //刀
Array(1702520, 10000), //彩虹泡沫
Array(1702442, 10000), //棒球棒
Array(1702433, 10000), //莎莉曼德
Array(1702489, 10000), //丝滑巧克力棒棒糖
Array(1702559, 10000), //泰迪小伙伴(白)
Array(1702557, 10000), //清扫掸子
Array(1702534, 10000), //嘟嘟奶嘴
Array(1702533, 10000), //奶兔立拍得
Array(1702530, 10000), //美味糖果武器
Array(1702510, 10000), //兔兔熊手电筒
Array(1702509, 10000), //彩糖棒
Array(1702508, 10000), //草莓牛奶武器
Array(1702507, 10000), //波点娃娃小扇子
Array(1702506, 10000), //普通平底锅
Array(1702505, 10000), //粉嘟嘟熊的竹节
Array(1702501, 10000), //玫瑰花舞
Array(1702499, 10000), //林之灵武器
Array(1702491, 10000), //闪闪小伙伴
Array(1702490, 10000), //肃清者暗笼
Array(1702488, 10000), //邦尼的胡萝卜
Array(1702487, 10000), //花红
Array(1702486, 10000), //茶花纷飞
Array(1702485, 10000), //大包小包
Array(1702483, 10000), //管狐
Array(1702480, 10000), //月亮女神
Array(1702478, 10000), //猫猫爪
Array(1702477, 10000), //邪恶骷髅
Array(1702473, 10000), //岩炎执行者
Array(1702463, 10000), //幻夜祭华
Array(1702461, 10000), //充满孝心的小鸡
Array(1702460, 10000), //星星武器
Array(1702457, 10000), //冬天里的雪糕
Array(1702455, 10000), //真红油漆桶
Array(1702454, 10000), //波浪海豹抱枕
Array(1702453, 10000), //雷霆之怒
Array(1702446, 10000), //和海獭一起
Array(1702432, 10000), //十八般兵器
Array(1702423, 10000), //鬼火
Array(1702417, 10000), //苍恋玫瑰阳伞
Array(1702445, 10000), //名侦探的放大镜
Array(1702402, 10000), //高尔夫球棒
Array(1702401, 10000), //兔子胡萝卜武器
Array(1702393, 10000), //蛇年武器
Array(1702471, 10000), //黑暗小恶魔武器
Array(1702390, 10000), //喵喵雨伞
Array(1702382, 10000), //满月柿子树枝
Array(1702381, 10000), //双月刀
Array(1702379, 10000), //阿拉伯魔术洋灯
Array(1702378, 10000), //国庆闪亮之光
Array(1702375, 10000), //亚特兰蒂斯
Array(1702372, 10000), //圣杯武器
Array(1702373, 10000), //烟花祭团扇
Array(1702371, 10000), //舞杖
Array(1702368, 10000), //黑暗蝴蝶魔棒
Array(1702367, 10000), //玫瑰苏菲亚
Array(1702366, 10000), //冰鲨鱼
Array(1702359, 10000), //蓝色天使注射器
Array(1702358, 10000), //我的朋友品克缤
Array(1702406, 10000), //坠星魔术空间
Array(1702352, 10000), //奶茶搅拌勺
Array(1702466, 10000), //薄荷巧克力蛋糕魔法棒
Array(1702350, 10000), //巧克力蛋糕魔法棒
Array(1702348, 10000), //雪片
Array(1702347, 10000), //怪盗幻影权杖
Array(1702426, 10000), //暴风领主
Array(1702342, 10000), //奥尔卡的兔娃娃
Array(1702346, 10000), //福袋
Array(1702334, 10000), //水晶幻想曲
Array(1702329, 10000), //草莓果篮
Array(1702310, 10000), //星光魔法棒
Array(1702306, 10000), //花风芭蕉扇
Array(1702308, 10000), //花枝芽
Array(1702305, 10000), //胡萝卜武器
Array(1702448, 10000), //妙趣悠悠球
Array(1702303, 10000), //牛奶瓶
Array(1702302, 10000), //杯具
Array(1702295, 10000), //扑克牌
Array(1702291, 10000), //玲珑扇
Array(1702250, 10000), //钞票箱
Array(1702233, 10000), //彩虹画笔
Array(1702228, 10000), //可可香蕉
Array(1702204, 10000), //日本铁扇
Array(1702071, 10000), //拉拉队毛巾(日本)
Array(1702194, 10000), //圣火火炬
Array(1702193, 10000), //湿抹布
Array(1702182, 10000), //洛丽波板糖
Array(1702155, 10000), //绚丽彩虹
Array(1702175, 10000), //膨胀的香肠
Array(1702123, 10000), //八戒钉耙
Array(1702112, 10000), //如意金箍棒
Array(1702087, 10000), //红色铅笔
Array(1702050, 10000), //手机
Array(1702029, 10000), //白猫拳
Array(1702009, 10000), //虎爪手套
Array(1092063, 10000), //禁烟板
Array(1092108, 10000), //啤酒杯盾牌
Array(1092112, 10000), //蚊香盾牌
Array(1092040, 10000), //雪花盾牌
Array(1092032, 10000), //饼干
Array(1702179, 10000), //蓝蓝天空枕头
Array(1702261, 10000), //樱花棒
Array(1702309, 10000), //彩虹烟火棒
Array(1702528, 10000), //木琴旋律
Array(1702201, 10000), //骷髅棒
Array(1702548, 10000), //黄金香蕉
Array(1702456, 10000), //精灵皮克
Array(1702349, 10000) //茅山道士铜钱剑
);
var selectedItem = -1;
var selectedCost = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status >= 0) {
            cm.dispose();
            return;
        }
        status--;
    }
    if (status == 0) {
        var selStr = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的道具：";
        for (var i = 0; i < itemList.length; i++) {
            selStr += "\r\n#L" + i + "##i" + itemList[i][0] + ":# #b#t" + itemList[i][0] + "##k   #r" + itemList[i][1] / 1 + " #k点卷#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        var item = itemList[selection];
        if (item != null) {
            selectedItem = item[0];
            selectedCost = item[1] / 1;
            cm.sendYesNo("您是否购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + " #k 点卷？");
        } else {
            cm.sendOk("出现错误...");
            cm.dispose();
        }
    } else if (status == 2) {
        if (selectedCost <= 0 || selectedItem <= 0) {
            cm.sendOk("购买道具出现错误...");
            cm.dispose();
            return;
        }
        if (cm.getPlayer().getCSPoints(1) >= selectedCost) {
            var gachaponItem = cm.gainGachaponItem(selectedItem, 1, "点卷商店", 3, true);
            if (gachaponItem != -1) {
                cm.gainNX( - selectedCost);
                cm.sendOk("恭喜您成功购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k。");
            } else {
                cm.sendOk("购买失败，请您确认在背包所有栏目窗口中是否有一格以上的空间。");
            }
        } else {
            cm.sendOk("您没有那么多点卷。\r\n\r\n购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷。");
        }
        cm.dispose();
    }
}
